Added host.enabled flag.
authorewan@localhost.localdomain <ewan@localhost.localdomain>
Mon, 16 Apr 2007 20:10:39 +0000 (16:10 -0400)
committerewan@localhost.localdomain <ewan@localhost.localdomain>
Mon, 16 Apr 2007 20:10:39 +0000 (16:10 -0400)
Signed-off-by: Ewan Mellor <ewan@xensource.com>
docs/xen-api/xenapi-datamodel.tex
tools/libxen/include/xen_host.h
tools/libxen/src/xen_host.c
tools/python/xen/xend/XendAPI.py

index 7a2a493a57c497a25d478ae576cc480c952699ba..39055b8d89ebb861788033e4d4c68f358f726c3f 100644 (file)
@@ -5086,6 +5086,7 @@ $\mathit{RO}_\mathit{run}$ &  {\tt API\_version/major} & int & major version num
 $\mathit{RO}_\mathit{run}$ &  {\tt API\_version/minor} & int & minor version number \\
 $\mathit{RO}_\mathit{run}$ &  {\tt API\_version/vendor} & string & identification of vendor \\
 $\mathit{RO}_\mathit{run}$ &  {\tt API\_version/vendor\_implementation} & (string $\rightarrow$ string) Map & details of vendor implementation \\
+$\mathit{RO}_\mathit{run}$ &  {\tt enabled} & bool & True if the host is currently enabled \\
 $\mathit{RO}_\mathit{run}$ &  {\tt software\_version} & (string $\rightarrow$ string) Map & version strings \\
 $\mathit{RW}$ &  {\tt other\_config} & (string $\rightarrow$ string) Map & additional configuration \\
 $\mathit{RO}_\mathit{run}$ &  {\tt capabilities} & string Set & Xen capabilities \\
@@ -5694,6 +5695,38 @@ Get the API\_version/vendor\_implementation field of the given host.
 }
 
 
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_enabled}
+
+{\bf Overview:} 
+Get the enabled field of the given host.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} bool get_enabled (session_id s, host ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt host ref } & self & reference to the object \\ \hline 
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:} 
+{\tt 
+bool
+}
+
+
 value of the field
 \vspace{0.3cm}
 \vspace{0.3cm}
index 181aa5e22dce6d74d7c7411e57b32f31513a1079..cb2c447fc46f8c1efdf44591faf3c5a6c1ae0028 100644 (file)
@@ -76,6 +76,7 @@ typedef struct xen_host_record
     int64_t api_version_minor;
     char *api_version_vendor;
     xen_string_string_map *api_version_vendor_implementation;
+    bool enabled;
     xen_string_string_map *software_version;
     xen_string_string_map *other_config;
     struct xen_string_set *capabilities;
@@ -241,6 +242,13 @@ extern bool
 xen_host_get_api_version_vendor_implementation(xen_session *session, xen_string_string_map **result, xen_host host);
 
 
+/**
+ * Get the enabled field of the given host.
+ */
+extern bool
+xen_host_get_enabled(xen_session *session, bool *result, xen_host host);
+
+
 /**
  * Get the software_version field of the given host.
  */
index bc2b1f0e8ba2b810f5c064118a48fe0485ba5981..331ed2105b752263d7f1e424ee3a6d15a37ff7b2 100644 (file)
@@ -64,6 +64,9 @@ static const struct_member xen_host_record_struct_members[] =
         { .key = "API_version_vendor_implementation",
           .type = &abstract_type_string_string_map,
           .offset = offsetof(xen_host_record, api_version_vendor_implementation) },
+        { .key = "enabled",
+          .type = &abstract_type_bool,
+          .offset = offsetof(xen_host_record, enabled) },
         { .key = "software_version",
           .type = &abstract_type_string_string_map,
           .offset = offsetof(xen_host_record, software_version) },
@@ -306,6 +309,22 @@ xen_host_get_api_version_vendor_implementation(xen_session *session, xen_string_
 }
 
 
+bool
+xen_host_get_enabled(xen_session *session, bool *result, xen_host host)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = host }
+        };
+
+    abstract_type result_type = abstract_type_bool;
+
+    XEN_CALL_("host.get_enabled");
+    return session->ok;
+}
+
+
 bool
 xen_host_get_software_version(xen_session *session, xen_string_string_map **result, xen_host host)
 {
index 89f0265f8b28f90b09a3f09c629a4a2fb55f9566..add54448a6b3c93d76b3d949662f70467ea4a094 100644 (file)
@@ -876,7 +876,8 @@ class XendAPI(object):
                     'API_version_major',
                     'API_version_minor',
                     'API_version_vendor',
-                    'API_version_vendor_implementation']
+                    'API_version_vendor_implementation',
+                    'enabled']
     
     host_attr_rw = ['name_label',
                     'name_description',
@@ -933,8 +934,8 @@ class XendAPI(object):
         return xen_api_success(XEN_API_VERSION_VENDOR)
     def host_get_API_version_vendor_implementation(self, _, ref):
         return xen_api_success(XEN_API_VERSION_VENDOR_IMPLEMENTATION)
-    def host_get_software_version(self, session, host_ref):
-        return xen_api_success(XendNode.instance().xen_version())
+    def host_get_enabled(self, _, _):
+        return xen_api_success(XendDomain.instance().allow_new_domains())
     def host_get_resident_VMs(self, session, host_ref):
         return xen_api_success(XendDomain.instance().get_domain_refs())
     def host_get_PBDs(self, _, ref):